Rocket equation
Newtonian mechanics
Newton's second law has to be put in its slightly more general form to do the rocket equation properly
\begin{equation} \frac{d\vec{p}(t)}{dt} = \vec{F} \end{equation}which leads to
\begin{equation} m(t) \ddot{\vec{x}}(t) + \dot{m}(t) \dot{\vec{x}}(t) = \vec{F} \end{equation}We therefore have two functions to decide : the thrust provided to the rocket, giving us the force, and the mass lost in the process. Let's consider the case of an ideal rocket, where the exhaust leaves it all in precisely the same direction and with the same velocity. In this case, the exhaust has, between two moments $t_1$ and $t_2$, the momentum
\begin{equation} \vec{p}_e(t) = - (m(t_1) - m(t_2) v_e \vec{e}_z \end{equation}If we assume all momenta conserved, $\vec{p}_s + \vec{p}_e$ is conserved through time. By taking the limit $t_2 \to t_1$, we can compute the limit of the time derivative of the exhaust momentum :
\begin{equation} \dot{\vec{p}}_e(t) = - \lim_{h \to 0} \frac{m(t) - m(t + h)}{h} v_e \vec{e}_z \end{equation}If we assume the mass flow constant here, this will be
\begin{equation} \dot{\vec{p}}_e(t) = -\dot{m} v_e \vec{e}_z \end{equation}So that we can deduce the change of momentum of our rocket here, and finally get Newton's second law :
\begin{equation} \dot{\vec{p}}_R(t) = \dot{m} v_e \vec{e}_z \end{equation} \begin{equation} m_R(t) \ddot{\vec{x}}_R(t) + \dot{m}_R \dot{\vec{x}}_R(t) = \dot{m} v_e \vec{e}_z \end{equation}For simplicity, let's assume all things in the $z$ direction
\begin{equation} m_R(t) \ddot{z}_R(t) + \dot{m}_R \dot{z}_R(t) = \dot{m} v_e \end{equation}Here we know that any mass gained by the exhaust is mass lost by the rocket, so that $\dot{m}_R = - \dot{m}$, and the total mass lost with time will therefore be $\int dt \dot{m} = \dot{m}t$. In other words,
\begin{equation} (m_R - \dot{m}t) \ddot{z}_R(t) = \dot{m} (v_e + \dot{z}_R(t)) \end{equation}